//
//  ViewController.m
//  block-demo
//
//  Created by holyen on 12-12-12.
//  Copyright (c) 2012年 holyen. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
}

//最简单的用法:
- (void)block1
{
    int (^square)(int);//定义了一个block变量
    square = ^(int a){return a * a;};//实现了这个block功能
    int result = square(5);//调用了这个block
    //int result = ^(int a){return a * a;}(5);
    NSLog(@"result : %d",result);
}

- (void)block2
{
    
}

@end
